package cn.tnar.controller;

import cn.tnar.wx.components.WxMessageComponent;
import cn.tnar.wx.dto.ServiceNewsMsg;
import cn.tnar.wx.dto.ServiceTextMsg;
import cn.tnar.wx.dto.TemplateMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 陈亮
 * @Date: 2018/10/14 11:55
 */
@Api(tags = "微信-消息管理")
@RestController
public class WxMsgController {

    @Autowired
    private WxMessageComponent wxMessageComponent;

    @ApiOperation(value = "发送客服消息[文本消息]")
    @PostMapping(value = "sendmsgtext")
    public Object sendMsgText(@RequestHeader("Token") String token,@RequestBody ServiceTextMsg msg) {
        return wxMessageComponent.sendMsgText(msg);
    }

    @ApiOperation(value = "发送客服消息[图文消息]")
    @PostMapping(value = "sendmsgnews")
    public Object sendMsgNews(@RequestHeader("Token") String token,@RequestBody ServiceNewsMsg msg) {
        return wxMessageComponent.sendMsgNews(msg);
    }

    @ApiOperation(value = "发送模板消息")
    @PostMapping(value = "sendmsgtemplate")
    public Object sendMsgTemplate(@RequestHeader("Token") String token,@RequestBody TemplateMsg msg) {
        return wxMessageComponent.sendMsgTemplate(msg);
    }


}
